home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Belgian Amiga Club - ADF Collection
/
BS1 part 19.zip
/
BS1 part 19
/
PD 3.adf
/
Drw
/
consupp
< prev
next >
Wrap
Text File
|
1986-11-20
|
1KB
|
63 lines
\
\ Console device support module... turn normal IO into console IO
\
anew ConSupp.spot
\
Create SampleCons
0," CON:10/10/400/100/Console Screen"
Variable ConErrata
Variable ConHandle
Variable OldConOut
Variable OldConIn
: OpenDosCon ( 0$ or nothing --- )
?dup 0= if SampleCons then
1006 ( ModeNewFIle ) swap !D1 !D2 DOs@ 5 ( Open ) Dup Not
IF ." Cant open console window!" 1 ConErrata ! Then
ConHandle !
;
: CloseDosCon
ConHandle @ ?DUP IF !D1 Dos 6 ( Close ) THEN
;
: ZapDosCon ( 0$ or not --- )
OpenDosCon
OUTFILE Dup @ OldConOut ! ConHandle @ Swap !
INFILE Dup @ OldConIn ! ConHandle @ Swap !
ConErrata Off
;
: UnzapDosCon
OldCOnIn @ INFILE ! OldConOut @ OUTFILE ! CloseDosCon
;
\
\ all 4th output now goes to CON:... for input tho...
\
: Dosread
!D1 !D3 !D2 Dos@ 7 ( Read )
;
: ConGet0$ ( Var expectedLen -- )
locals| Vlen VVar |
VVar Vlen 0 fill \ zero it first
VVar Vlen ConHandle @ DosRead
\ might have a LF at end...
VVar + 1- 0 swap c!
;
Create ConNumBuf 20 allot
: ConGet# ( -- #/TRUE or FALSE )
Connumbuf 20 0 fill
ConnumBuf 20 ConHandle @ Dosread
ConnumBuf Swap $>Number
;
create confnam 40 allot
: ConTEst
0 ZapDosCOn
." I am a console: gimme number:"
ConGet#
cr ." FileName?" confnam 40 ConGet0$
UnzapDosCon
." string is:" confnam dup 0$len type
cr IF hex . decimal ." is it in hex" cr else ." not a number!" cr then
;
." ConSUPP.." CR